import type { AxiosRequestConfig, AxiosResponse } from 'axios';

// 定义拦截器接口
export interface MYRequestInterceptors<T = AxiosResponse> {
  // 属性可以写成可选的
  requestInterceptor?: (config: AxiosRequestConfig) => AxiosRequestConfig;
  requestInterceptorCatch?: (error: any) => any;
  responseInterceptor?: (res: T) => T;
  responseInterceptorCatch?: (error: any) => any;
}

// 给默认的axios定义的config接口进行拓展
export interface MYRequestConfig<T = AxiosResponse> extends AxiosRequestConfig {
  _interceptors?: MYRequestInterceptors<T>;
}
